package com.trt.api.controller.files;

import com.trt.pojo.dto.AdminUserBO;
import com.trt.utils.ApiResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * @author tanrentao
 * @date 2021-12-03
 * @desc
 */
@Api(value = "文件上传相关", tags = "{文件上传相关的controller}")
@RequestMapping("fs")
public interface FileUploaderControllerApi {

    @ApiOperation(value = "通过fdfs上传用户头像", notes = "上传用户头像", httpMethod = "POST")
    @PostMapping("/uploadFace")
    public ApiResult uploadToFdfsFace(@RequestParam String userId, MultipartFile file) throws Exception;

    @ApiOperation(value = "通过OSS上传用户头像", notes = "上传用户头像", httpMethod = "POST")
    @PostMapping("/uploadToOSSFace")
    public ApiResult uploadToOSSFace(@RequestParam String userId, MultipartFile file) throws Exception;

    @ApiOperation(value = "通过MinIO上传用户头像", notes = "上传用户头像", httpMethod = "POST")
    @PostMapping("/uploadToMinIOFace")
    public ApiResult uploadToMinIOFace(@RequestParam String userId, MultipartFile file) throws Exception;

    /**
     * 不能使用swagger, 文件上传到mongodb的gridfs中
     */
    @PostMapping("/uploadToGridFS")
    public ApiResult uploadToGridFS(@RequestBody AdminUserBO adminUserBO) throws Exception;

    /**
     * 从gridfs中读取图片内容
     */
    @GetMapping("/readInGridFS")
    public void readInGridFS(String faceId, HttpServletResponse response) throws Exception;

}
